<template>
  <div>
    <h1>我是A</h1>
    <!-- <router-link to="/">点我回主页</router-link> -->
    <el-button plain @click="goMain()">回到主页</el-button>
    <div class="input">
      <el-input v-model="aId" placeholder="请输入要向B传递的参数"></el-input>
    </div>
    <div>
      <el-button plain @click="goB()">点我到B页面用query传参</el-button>
      <el-button plain @click="goBp()">点我到B页面用params传参</el-button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      aId: "",
    };
  },
  methods: {
    goB() {
      //query
      this.$router.push({
        // name:'zywB',
        path: "/zywB",
        query: {
          aId: this.aId,
        },
      });
    },
    goBp() {
      //params
      this.$router.push({
        name: "zzz",
        params: {
          aId: this.aId,
        },
      });
    },
    goMain() {
      this.$router.push({
        path: "/",
      });
    },
  },
};
</script>

<style scoped>
.input {
  width: 50%;
  margin: 0 auto;
}
.el-button {
  margin: 10px;
}
</style>